//
//  LzwDeviseTablecell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/1.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwDeviseTablecell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"

@interface LzwDeviseTablecell ()

@property (nonatomic, retain) LzwBaseImageView *myIamgeDevise;
@property (nonatomic, retain) LzwBaseImageView *myIamgeDevise1;

@property (nonatomic, retain) LzwBaseLable *myLableDevise;
@property (nonatomic, retain) LzwBaseLable *myLableDevise1;


@end

@implementation LzwDeviseTablecell

-(void)dealloc{
    
    [_myIamgeDevise release];
    [_myIamgeDevise1 release];
    [_myLableDevise release];
    [_myLableDevise1 release];
    [super dealloc];
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatDevise];
    }
    return self;
}

-(void)creatDevise{
    
    //图片
    self.myIamgeDevise = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(3 * WIDTH, 3 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myIamgeDevise.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myIamgeDevise];
    
    //喜爱图片
    self.myIamgeDevise1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myIamgeDevise1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myIamgeDevise1];
    
    //描述
    self.myLableDevise = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLableDevise.textColor = [UIColor lightGrayColor];
    self.myLableDevise.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableDevise.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableDevise];
    
    //喜爱人数
    self.myLableDevise1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLableDevise1.textColor = [UIColor lightGrayColor];
    self.myLableDevise1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableDevise1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableDevise1];
    
    [_myIamgeDevise release];
    [_myIamgeDevise1 release];
    [_myLableDevise release];
    [_myLableDevise1 release];
    
}

-(void)setModleDevise:(LzwDeviseModle *)modleDevise{
    
    if (_modleDevise != modleDevise) {
        
        [_modleDevise release];
        
        _modleDevise = [modleDevise retain];
        
    }
    
    self.myLableDevise.text = self.modleDevise.title;
    self.myLableDevise1.text = self.modleDevise.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleDevise.pic];
    
    [self.myIamgeDevise sd_setImageWithURL:url placeholderImage:nil];
    
}

@end
